export default {
  state:{
    userInfo:{
      id:cookie.get('fbzUserId'),
      username:cookie.get('fbzUserName'),
    },
    token:cookie.get('fbzToken')
  },
  getters:{
    getUserId(state){
      return state.userInfo.id
    },
    getUserName(state){
      return state.userInfo.username
    },
    getToken(state){
      return state.token
    }
  },
  mutations:{
    loginSuccess(state,data){
      // console.log(data)
      state.userInfo=data.userInfo
      state.token=data.token
      cookie.set('fbzToken',state.token)
      cookie.set('fbzUserName',data.userInfo.username)
      cookie.set('fbzUserId',data.userInfo.id)

    }
  },
}
import cookie from 'js-cookie'
